//
//  YDOAMyBanApplyVC.swift
//  YDOAProduct
//
//  Created by 占益民 on 2017/11/28.
//  Copyright © 2017年 Allen. All rights reserved.
//

import UIKit
import Toaster
class YDOAMyBanApplyVC: UIViewController {

    @IBOutlet weak var myTableView: UITableView!
    var applyType : Int! = nil //申请类型 1： 办公申请  2  月度申请
    
    lazy var dataSource : NSMutableArray = NSMutableArray()
    
    override func viewDidLoad() {
        super.viewDidLoad()
       
        myTableView.register(UINib(nibName: "YDOAMyBanApplyCell", bundle: nil), forCellReuseIdentifier: "YDOAMyBanApplyCell")
        
        loadData()
    }
    
    fileprivate func loadData(){
        var urlStr : String = ""
        let userinfo = UserDefaults.standard.object(forKey: USERINFO) as! [String:AnyObject]
        let uid =  userinfo["id"]!
        YMLog.log(item: uid)
        if applyType == 1 {
            //办公用品
            urlStr = String(format:"%ld",uid as! CVarArg)
        }else{
            //月度申请
            urlStr = String(format:"%ld",uid as! CVarArg)
        }
        return ;
        YMNetworkManager().getRequest(urlString: "XX", params: nil, success: { (responser) in
            if !responser.isEmpty && responser["status"]?.int8Value == 1{
                
            }else{
                Toast(text: responser["message"] as? String, delay: 0, duration: 1.5).show()
            }
        }) { (error) in
            
        }
    }
    
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        
    }
}

extension YDOAMyBanApplyVC : UITableViewDelegate,UITableViewDataSource{
   
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        guard let cell = tableView
            .dequeueReusableCell(withIdentifier: "YDOAMyBanApplyCell") else {
                return YDOAMyBanApplyCell()
        }
        cell.selectionStyle = .none
        return cell
    }
    
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 99
    }
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 20
    }
    
}
